package org.showminifier.core;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.IdentityType;

import com.google.appengine.api.datastore.Key;

import org.mozilla.javascript.Scriptable;

/**
*
* Show Minifier
* Author: Shihua Ma <beijing.josh@gmail.com>
* Copyright (c) 2010 Shihua Ma
* Licensed under the MIT license.
*
*/

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Options{
	
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;
	
	//Remove comments
	@Persistent
	private boolean removeComments;
	
	//remove comments from scripts and styles
	@Persistent
	private boolean removeCommentsFromCdata;
	
	//Remove CDATA sections from scripts and styles
	@Persistent
	private boolean removeCdataSectionsFromCdata;
	
	//Collapse whitespace
	@Persistent
	private boolean collapseWhitespace;
	
	//Collapse boolean attributes 
	@Persistent
	private boolean collapseBooleanAttributes;
	
	//Remove attribute quotes
	@Persistent
	private boolean removeAttributeQuotes;
	
	//Remove redundant attributes/values
	@Persistent
	private boolean removeRedundantAttributes;
	
	//Use short doctype
	@Persistent
	private boolean useShortDoctype;
	
	//Remove empty (or blank) attributes
	@Persistent
	private boolean removeEmptyAttributes;
	
	//Remove empty elements
	@Persistent
	private boolean removeEmptyElements;
	
	//Remove type="text/javascript" from script's
	@Persistent
	private boolean removeScriptTypeAttributes;
	
	//Remove type="text/css" from style's
	@Persistent
	private boolean removeStyleTypeAttributes;
	
	//Remove optional tags
	@Persistent
	private boolean removeOptionalTags;

	//Remove URL scheme
	@Persistent
	private boolean removeUrlScheme;
	
	//The URL scheme,defualt is http://
	@Persistent
	private String urlCheme = "http://";
	
	//Validate input through HTML lint
	@Persistent
	private boolean embedLint = false;
	
	
	private Scriptable lint;
	
	public Scriptable getLint() {
		return this.lint;
	}

	public void setLint(Scriptable lint) {
		this.lint = lint;
	}

	public boolean isRemoveComments() {
		return removeComments;
	}

	public void setRemoveComments(boolean removeComments) {
		this.removeComments = removeComments;
	}


	public boolean isCollapseWhitespace() {
		return collapseWhitespace;
	}

	public void setCollapseWhitespace(boolean collapseWhitespace) {
		this.collapseWhitespace = collapseWhitespace;
	}

	public boolean isCollapseBooleanAttributes() {
		return collapseBooleanAttributes;
	}

	public void setCollapseBooleanAttributes(boolean collapseBooleanAttributes) {
		this.collapseBooleanAttributes = collapseBooleanAttributes;
	}

	public boolean isRemoveAttributeQuotes() {
		return removeAttributeQuotes;
	}

	public void setRemoveAttributeQuotes(boolean removeAttributeQuotes) {
		this.removeAttributeQuotes = removeAttributeQuotes;
	}

	public boolean isRemoveRedundantAttributes() {
		return removeRedundantAttributes;
	}

	public void setRemoveRedundantAttributes(boolean removeRedundantAttributes) {
		this.removeRedundantAttributes = removeRedundantAttributes;
	}

	public boolean isUseShortDoctype() {
		return useShortDoctype;
	}

	public void setUseShortDoctype(boolean useShortDoctype) {
		this.useShortDoctype = useShortDoctype;
	}

	public boolean isRemoveEmptyAttributes() {
		return removeEmptyAttributes;
	}

	public void setRemoveEmptyAttributes(boolean removeEmptyAttributes) {
		this.removeEmptyAttributes = removeEmptyAttributes;
	}

	public boolean isRemoveEmptyElements() {
		return removeEmptyElements;
	}

	public void setRemoveEmptyElements(boolean removeEmptyElements) {
		this.removeEmptyElements = removeEmptyElements;
	}

	public boolean isRemoveOptionalTags() {
		return removeOptionalTags;
	}

	public void setRemoveOptionalTags(boolean removeOptionalTags) {
		this.removeOptionalTags = removeOptionalTags;
	}

	public Key getKey() {
		return this.key;
	}

	public void setKey(Key key) {
		this.key = key;
	}

	public boolean isRemoveCommentsFromCdata() {
		return this.removeCommentsFromCdata;
	}

	public void setRemoveCommentsFromCdata(boolean removeCommentsFromCdata) {
		this.removeCommentsFromCdata = removeCommentsFromCdata;
	}

	public boolean isRemoveCdataSectionsFromCdata() {
		return this.removeCdataSectionsFromCdata;
	}

	public void setRemoveCdataSectionsFromCdata(boolean removeCdataSectionsFromCdata) {
		this.removeCdataSectionsFromCdata = removeCdataSectionsFromCdata;
	}

	public boolean isRemoveUrlScheme() {
		return this.removeUrlScheme;
	}

	public void setRemoveUrlScheme(boolean removeUrlScheme) {
		this.removeUrlScheme = removeUrlScheme;
	}

	public boolean isEmbedLint() {
		return embedLint;
	}

	public void setEmbedLint(boolean embedLint) {
		this.embedLint = embedLint;
	}

	public boolean isRemoveScriptTypeAttributes() {
		return removeScriptTypeAttributes;
	}
	
	public void setRemoveScriptTypeAttributes(boolean removeScriptTypeAttributes) {
		this.removeScriptTypeAttributes = removeScriptTypeAttributes;
	}

	public String getUrlCheme() {
		return urlCheme;
	}

	public void setUrlCheme(String urlCheme) {
		this.urlCheme = urlCheme;
	}

	public boolean isRemoveStyleTypeAttributes() {
		return removeStyleTypeAttributes;
	}

	public void setRemoveStyleTypeAttributes(boolean removeStyleTypeAttributes) {
		this.removeStyleTypeAttributes = removeStyleTypeAttributes;
	}
}
